home *** CD-ROM | disk | FTP | other *** search
/ CyberMycha 2008 January / Cybermycha 1_2008.iso / Data.cab / _379818100DC6441DABE4DC43258CBE54 < prev    next >
Encoding:
Text File  |  2004-07-19  |  1.6 KB  |  79 lines

  1.  
  2. regc(2, "COMBINED_XFORM")
  3. regc(6, "MODEL_XFORM")
  4.  
  5. regc(12, "FOG_PARAMS")
  6.  
  7. regc(13, "CAMERA_POS_MS")
  8. regcn(14, "DIRECTIONAL_DIR_MS", 0)
  9.  
  10. regc4f(30, 0.0, 0.0, 0.0, %sunvisibility)
  11. regc4f(31, %ambient_r, %ambient_g, %ambient_b, %ambient_a)
  12. // ------------ c40 - c70 reserved
  13. !include("vs_spot_consts.inc")
  14.  
  15. vshader("
  16.  
  17. #define point        v0
  18. #define normal        v1
  19. #define tangent        v2
  20. #define tcoord        v3
  21.  
  22. #define fogp    c12
  23. #define cpos    c13
  24. #define ldir    c14
  25.  
  26.     vs_1_1
  27.  
  28. #include    <cardef.h>
  29. #include    <fog.inc>
  30.  
  31.     def c0, SPECULARPOW, 0, 0, 0
  32.  
  33.     dcl_position    point
  34.     dcl_normal    normal
  35.     dcl_tangent    tangent
  36.     dcl_texcoord    tcoord
  37.  
  38.     ; output position
  39.     m4x4    oPos, point, c2
  40.     ; output texcoords
  41.     mov        oT0, tcoord           
  42.     mov        oT1, tcoord           
  43.     ; calc fog
  44.        dp4    r0.x, point, c4
  45.        FOG(r0.x, fogp, r10)
  46.  
  47.     ; E in model space
  48.     add r2, cpos, -point
  49.     ; normalize E
  50.     dp3 r2.w, r2, r2
  51.     rsq r2.w, r2.w
  52.     mul r2.xyz, r2, r2.w
  53.  
  54.     ; reflect E
  55.     dp3 r5.w, r2, normal
  56.     add r6.w, r5.w, r5.w
  57.     mad r6.xyz, normal, r6.w, -r2 // dot(E, N)*2 *N - E
  58.  
  59.     dp3        r4.x, normal, ldir        ; diffuse N*L
  60.     dp3        r4.y, ldir, r6        ; specular L*E
  61.     mov        r4.w, c0.x              ; specular pow
  62.     lit        r3, r4
  63.  
  64.     ; output diffuse
  65.     mad        oD0.w, r3.y, c31.x, c31.w     //diffuse&ambient
  66.     // mul        oD0.w, r3.y   //  sunlight
  67.     ; output specular
  68.     mul        oD1, r3.z, c30.w    //sunvisibility
  69.  
  70. ;------------------------------------------
  71. // spot lights
  72. // used r0 - r2
  73. #if VS_SPOTLIGHTS
  74. #include <vs_spot_func.inc>
  75. #endif
  76. ;----------------------------
  77. ")
  78.  
  79.